//
//  SetupViewController.m
//  Globalstone
//
//  Created by 辰领科技 on 16/7/18.
//  Copyright © 2016年 yuf. All rights reserved.
//

#import "SetupViewController.h"

@interface SetupViewController ()
@property (strong, nonatomic) IBOutlet UIView *navView;
@property (strong, nonatomic) IBOutlet UIScrollView *scroview;
@property (weak, nonatomic) IBOutlet UIButton *exitButton;

@end

@implementation SetupViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initViewLayout];
}
- (void)initViewLayout{
    [self adaptiveViewLayout:self.view];
    [self adaptiveViewLayout:self.navView];
    [self adaptiveViewLayout:self.scroview];
    _scroview.contentSize = flexibleSize(CGSizeMake(0, 505), NO);
    self.view.backgroundColor = [UIColor colorWithWhite:0.953 alpha:1.000];
    _exitButton.layer.cornerRadius = 4*VerticalRatio();
    
    if (![Common getLoginStatus]) {
        _exitButton.hidden = YES;
    }
}

- (IBAction)back:(id)sender {
    [self backBtn];
}
#pragma mark - 清除缓存
- (IBAction)ClearTheCache:(id)sender {
}
#pragma mark - 使用帮助
- (IBAction)UseTheHelp:(id)sender {
    UIStoryboard * storyBoard = [UIStoryboard storyboardWithName:@"HomeStoryboard" bundle:nil];
    UIViewController * page = [storyBoard instantiateViewControllerWithIdentifier:@"UseTheHelp"];
    [[Common getNavigation]pushViewController:page];
}
#pragma mark - 平台简介
- (IBAction)Introduction:(id)sender {
    UIStoryboard * storyBoard = [UIStoryboard storyboardWithName:@"HomeStoryboard" bundle:nil];
    UIViewController * page = [storyBoard instantiateViewControllerWithIdentifier:@"Introduction"];
    [[Common getNavigation]pushViewController:page];
}
#pragma mark - 修改密码
- (IBAction)ChangeThePassword:(id)sender {
    UIStoryboard * storyBoard = [UIStoryboard storyboardWithName:@"PersonalStoryboard" bundle:nil];
    UIViewController * page = [storyBoard instantiateViewControllerWithIdentifier:@"ChangePassword"];
    [[Common getNavigation]pushViewController:page];
}
#pragma mark - 退出登录
- (IBAction)confirm:(id)sender {
    NSMutableDictionary * dic = [NSMutableDictionary dictionary];
    [dic setObject:[Common getLoginInfo][Key_User_userId] forKey:@"museId"];
    [dic setObject:[Common getLoginInfo][Key_User_onlineKey] forKey:@"museOnlineTag"];
    
    self.shareApi.delegate = self;
    [self.shareApi  requestOperationWithDic:dic withPath:GS_exitLogin withHttpType:@"POST" withTag:GS_GS_exitLogin];
}


#pragma   mark---- GetADBanner Request Delegate

-(void)fetchDatabaseFinished:(NSMutableDictionary *)database withTag:(NSInteger)tag{
    if (tag == GS_GS_exitLogin){
        if (  [[database valueForKey:@"flag"] integerValue]!=1 ) {
            
            [[CWHUDTips sharedInstance]  showTips:[database valueForKey:@"msg"]  withStatus:1 dismissAfter:1.5];
        }else  {
            [CWHUDTips showTips:@"退出登录成功"];
            [Common DeleteSingleFile];
            [[Common getNavigation]popTopViewController];
//            self.pageFinishBlock();
        }
    }
}
-(void)fetchDatabaseFailed:(NSError *)error message:(NSString *)message{
    
    [self dismissWaitDialog];
    
}


@end
